Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
"web_accessible_resources" works on one site but not another

So im getting the classic "Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension." error in the console. The problem is that I believe it is actually properly listed, since it works everywhere, except this site for some reason: https://raw.githubusercontent.com/InventivetalentDev/minecraft-assets/1.18.2/assets/minecraft/textures/block/dirt.png

Here are the relating parts of my files (I am using manifest v3):

manifest.json

    "web_accessible_resources": [
        {
          "resources": ["content.css", "sprite.svg"],
          "matches": ["<all_urls>"]
        }
    ],
    "content_scripts":
    [{
          "matches": ["<all_urls>"],
          "js": ["content-script.js"],
          "run_at": "document_start"
    }]

content-script.js

function injectCSS() {
  const link = newElement('link');
  const head = $('head');
  link.rel = 'stylesheet';
  link.type = "text/css"
  link.href = chrome.runtime.getURL('content.css');
  head.appendChild(link);
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

So, for anyone findig this question while looking for a solution for this problem in the future:

The reason this happens is that this site has a strict content policy, disallowing all resources (e.g. image or stylesheet) coming outside itself. There is 2 ways to solve this issue:

1. Easy and quick solution

  • Use this method only if you want to load a stylesheet (.css) every time, and only on the few specified websites in manifest.json!

manifest.json

"content_scripts":[
 {
   "js": ["content-script.js"],
   "css": ["style.css"],
   "matches": ["https://stackoverflow.com/*"]
 }
 ]

2. A hacky workaround I've learned from scripts

  • This method allows you to inject stylesheets without specifying anything in the manifest.json
  • For images, use BASE64 encoding. For SVGs, create them dinamically through JS.

content-script.js

window.addEventListener('load', function() {
   injectCSS();
})

function injectCSS() {
  const style = document.createElement('style');
  const head = document.querySelector('head');
  style.rel = 'stylesheet';
  style.type = "text/css"
  style.textContent = css;
  head.appendChild(style);
}


const css = `
::-webkit-scrollbar { 
  display: none;
}
`
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!